Optimal. Leaf size=209 \[ -\frac {A d^2-B c d+c^2 C}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}-\frac {2 c d (A-C)-B \left (c^2-d^2\right )}{f \left (c^2+d^2\right )^2 (c+d \tan (e+f x))}+\frac {\left (d (A-C) \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^3}-\frac {x \left (-A \left (c^3-3 c d^2\right )-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )}{\left (c^2+d^2\right )^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.38, antiderivative size = 209, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.121, Rules used = {3628, 3529, 3531, 3530} \[ -\frac {A d^2-B c d+c^2 C}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}-\frac {2 c d (A-C)-B \left (c^2-d^2\right )}{f \left (c^2+d^2\right )^2 (c+d \tan (e+f x))}+\frac {\left (d (A-C) \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^3}-\frac {x \left (-A \left (c^3-3 c d^2\right )-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )}{\left (c^2+d^2\right )^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3529
Rule 3530
Rule 3531
Rule 3628
Rubi steps
\begin {align*} \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{(c+d \tan (e+f x))^3} \, dx &=-\frac {c^2 C-B c d+A d^2}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}+\frac {\int \frac {A c-c C+B d+(B c-(A-C) d) \tan (e+f x)}{(c+d \tan (e+f x))^2} \, dx}{c^2+d^2}\\ &=-\frac {c^2 C-B c d+A d^2}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {2 c (A-C) d-B \left (c^2-d^2\right )}{\left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}+\frac {\int \frac {-c^2 C+2 B c d+C d^2+A \left (c^2-d^2\right )-\left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^2}\\ &=\frac {\left (A c^3-c^3 C+3 B c^2 d-3 A c d^2+3 c C d^2-B d^3\right ) x}{\left (c^2+d^2\right )^3}-\frac {c^2 C-B c d+A d^2}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {2 c (A-C) d-B \left (c^2-d^2\right )}{\left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}+\frac {\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^3}\\ &=\frac {\left (A c^3-c^3 C+3 B c^2 d-3 A c d^2+3 c C d^2-B d^3\right ) x}{\left (c^2+d^2\right )^3}+\frac {\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right )^3 f}-\frac {c^2 C-B c d+A d^2}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {2 c (A-C) d-B \left (c^2-d^2\right )}{\left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 5.28, size = 261, normalized size = 1.25 \[ -\frac {-(d (C-A)+B c) \left (\frac {d \left (\frac {\left (c^2+d^2\right ) \left (5 c^2+4 c d \tan (e+f x)+d^2\right )}{(c+d \tan (e+f x))^2}+\left (2 d^2-6 c^2\right ) \log (c+d \tan (e+f x))\right )}{\left (c^2+d^2\right )^3}+\frac {i \log (-\tan (e+f x)+i)}{(c+i d)^3}-\frac {\log (\tan (e+f x)+i)}{(d+i c)^3}\right )+B \left (\frac {2 d \left (\frac {c^2+d^2}{c+d \tan (e+f x)}-2 c \log (c+d \tan (e+f x))\right )}{\left (c^2+d^2\right )^2}+\frac {i \log (-\tan (e+f x)+i)}{(c+i d)^2}-\frac {i \log (\tan (e+f x)+i)}{(c-i d)^2}\right )+\frac {C}{(c+d \tan (e+f x))^2}}{2 d f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.72, size = 566, normalized size = 2.71 \[ -\frac {3 \, C c^{4} d - 5 \, B c^{3} d^{2} + {\left (7 \, A - 3 \, C\right )} c^{2} d^{3} + B c d^{4} + A d^{5} - 2 \, {\left ({\left (A - C\right )} c^{5} + 3 \, B c^{4} d - 3 \, {\left (A - C\right )} c^{3} d^{2} - B c^{2} d^{3}\right )} f x - {\left (C c^{4} d - 3 \, B c^{3} d^{2} + 5 \, {\left (A - C\right )} c^{2} d^{3} + 3 \, B c d^{4} - A d^{5} + 2 \, {\left ({\left (A - C\right )} c^{3} d^{2} + 3 \, B c^{2} d^{3} - 3 \, {\left (A - C\right )} c d^{4} - B d^{5}\right )} f x\right )} \tan \left (f x + e\right )^{2} + {\left (B c^{5} - 3 \, {\left (A - C\right )} c^{4} d - 3 \, B c^{3} d^{2} + {\left (A - C\right )} c^{2} d^{3} + {\left (B c^{3} d^{2} - 3 \, {\left (A - C\right )} c^{2} d^{3} - 3 \, B c d^{4} + {\left (A - C\right )} d^{5}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (B c^{4} d - 3 \, {\left (A - C\right )} c^{3} d^{2} - 3 \, B c^{2} d^{3} + {\left (A - C\right )} c d^{4}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (C c^{5} - 2 \, B c^{4} d + 3 \, {\left (A - C\right )} c^{3} d^{2} + 3 \, B c^{2} d^{3} - {\left (3 \, A - 2 \, C\right )} c d^{4} - B d^{5} + 2 \, {\left ({\left (A - C\right )} c^{4} d + 3 \, B c^{3} d^{2} - 3 \, {\left (A - C\right )} c^{2} d^{3} - B c d^{4}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (c^{6} d^{2} + 3 \, c^{4} d^{4} + 3 \, c^{2} d^{6} + d^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{7} d + 3 \, c^{5} d^{3} + 3 \, c^{3} d^{5} + c d^{7}\right )} f \tan \left (f x + e\right ) + {\left (c^{8} + 3 \, c^{6} d^{2} + 3 \, c^{4} d^{4} + c^{2} d^{6}\right )} f\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 1.39, size = 548, normalized size = 2.62 \[ \frac {\frac {2 \, {\left (A c^{3} - C c^{3} + 3 \, B c^{2} d - 3 \, A c d^{2} + 3 \, C c d^{2} - B d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {{\left (B c^{3} - 3 \, A c^{2} d + 3 \, C c^{2} d - 3 \, B c d^{2} + A d^{3} - C d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {2 \, {\left (B c^{3} d - 3 \, A c^{2} d^{2} + 3 \, C c^{2} d^{2} - 3 \, B c d^{3} + A d^{4} - C d^{4}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{6} d + 3 \, c^{4} d^{3} + 3 \, c^{2} d^{5} + d^{7}} + \frac {3 \, B c^{3} d^{3} \tan \left (f x + e\right )^{2} - 9 \, A c^{2} d^{4} \tan \left (f x + e\right )^{2} + 9 \, C c^{2} d^{4} \tan \left (f x + e\right )^{2} - 9 \, B c d^{5} \tan \left (f x + e\right )^{2} + 3 \, A d^{6} \tan \left (f x + e\right )^{2} - 3 \, C d^{6} \tan \left (f x + e\right )^{2} + 8 \, B c^{4} d^{2} \tan \left (f x + e\right ) - 22 \, A c^{3} d^{3} \tan \left (f x + e\right ) + 22 \, C c^{3} d^{3} \tan \left (f x + e\right ) - 18 \, B c^{2} d^{4} \tan \left (f x + e\right ) + 2 \, A c d^{5} \tan \left (f x + e\right ) - 2 \, C c d^{5} \tan \left (f x + e\right ) - 2 \, B d^{6} \tan \left (f x + e\right ) - C c^{6} + 6 \, B c^{5} d - 14 \, A c^{4} d^{2} + 11 \, C c^{4} d^{2} - 7 \, B c^{3} d^{3} - 3 \, A c^{2} d^{4} - B c d^{5} - A d^{6}}{{\left (c^{6} d + 3 \, c^{4} d^{3} + 3 \, c^{2} d^{5} + d^{7}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}^{2}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.29, size = 713, normalized size = 3.41 \[ -\frac {d A}{2 f \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {B c}{2 f \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {B \arctan \left (\tan \left (f x +e \right )\right ) d^{3}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {C \arctan \left (\tan \left (f x +e \right )\right ) c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {\ln \left (c +d \tan \left (f x +e \right )\right ) A \,d^{3}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {\ln \left (c +d \tan \left (f x +e \right )\right ) B \,c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {\ln \left (c +d \tan \left (f x +e \right )\right ) C \,d^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {B \,c^{2}}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {3 \ln \left (c +d \tan \left (f x +e \right )\right ) A \,c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {3 \ln \left (c +d \tan \left (f x +e \right )\right ) B c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {3 \ln \left (c +d \tan \left (f x +e \right )\right ) C \,c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {3 A \arctan \left (\tan \left (f x +e \right )\right ) c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) A \,c^{2} d}{2 f \left (c^{2}+d^{2}\right )^{3}}-\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) B c \,d^{2}}{2 f \left (c^{2}+d^{2}\right )^{3}}+\frac {A \arctan \left (\tan \left (f x +e \right )\right ) c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) A \,d^{3}}{2 f \left (c^{2}+d^{2}\right )^{3}}-\frac {d^{2} B}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) B \,c^{3}}{2 f \left (c^{2}+d^{2}\right )^{3}}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) C \,d^{3}}{2 f \left (c^{2}+d^{2}\right )^{3}}+\frac {3 B \arctan \left (\tan \left (f x +e \right )\right ) c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {3 C \arctan \left (\tan \left (f x +e \right )\right ) c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {c^{2} C}{2 f \left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {2 A c d}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {2 c C d}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) C \,c^{2} d}{2 f \left (c^{2}+d^{2}\right )^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.64, size = 367, normalized size = 1.76 \[ \frac {\frac {2 \, {\left ({\left (A - C\right )} c^{3} + 3 \, B c^{2} d - 3 \, {\left (A - C\right )} c d^{2} - B d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {2 \, {\left (B c^{3} - 3 \, {\left (A - C\right )} c^{2} d - 3 \, B c d^{2} + {\left (A - C\right )} d^{3}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {{\left (B c^{3} - 3 \, {\left (A - C\right )} c^{2} d - 3 \, B c d^{2} + {\left (A - C\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {C c^{4} - 3 \, B c^{3} d + {\left (5 \, A - 3 \, C\right )} c^{2} d^{2} + B c d^{3} + A d^{4} - 2 \, {\left (B c^{2} d^{2} - 2 \, {\left (A - C\right )} c d^{3} - B d^{4}\right )} \tan \left (f x + e\right )}{c^{6} d + 2 \, c^{4} d^{3} + c^{2} d^{5} + {\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{5} d^{2} + 2 \, c^{3} d^{4} + c d^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 11.88, size = 327, normalized size = 1.56 \[ -\frac {\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (B\,d^3+2\,A\,c\,d^2-B\,c^2\,d-2\,C\,c\,d^2\right )}{c^4+2\,c^2\,d^2+d^4}+\frac {A\,d^4+C\,c^4+5\,A\,c^2\,d^2-3\,C\,c^2\,d^2+B\,c\,d^3-3\,B\,c^3\,d}{2\,d\,\left (c^4+2\,c^2\,d^2+d^4\right )}}{f\,\left (c^2+2\,c\,d\,\mathrm {tan}\left (e+f\,x\right )+d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (B-A\,1{}\mathrm {i}+C\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^3-c^2\,d\,3{}\mathrm {i}+3\,c\,d^2+d^3\,1{}\mathrm {i}\right )}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (B\,c^3+\left (3\,C-3\,A\right )\,c^2\,d-3\,B\,c\,d^2+\left (A-C\right )\,d^3\right )}{f\,\left (c^6+3\,c^4\,d^2+3\,c^2\,d^4+d^6\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (C-A+B\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: AttributeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________